import request from '@/utils/request'

/**
 * 查询所有管理员信息
 * @returns 
 */
export async function queryAdminList() {
    return await request({
        url: '/adminSever/admin/queryAdminList',
        method: 'GET'
    })
}

/**
 * 修改管理员权限
 * @param {*} data 
 * @returns 
 */
export async function editPower(data) {
    return await request({
        url: '/adminSever/manage/editPower',
        method: 'PUT',
        data
    })
}

/**
 * 获取用户列表
 * @param {*} data 
 * @returns 
 */
export async function queryUserList(params) {
    return await request({
        url: "/adminSever/manage/users",
        method: "GET",
        params
    })
}

/**
 * 删除用户根据id
 * @param {*} id 
 * @returns 
 */
export async function deleteUserById(id) {
    return await request({
        url: `/adminSever/manage/${id}`,
        method: "DELETE"
    })
}

/**
 * 修改用户信息
 * @param {*} data 
 */
export async function modifyUserInfo(data) {
    return await request({
        url: '/adminSever/manage',
        method: "PUT",
        data
    })
} 

/**
 * 保存新用户
 * @param {*} data 
 * @returns 
 */
export async function saveNewUser(data) {
    return await request({
        url: '/adminSever/manage',
        method: 'POST',
        data
    })
}

/**
 * 修改用户密码
 * @param {*} data 
 */
export async function modifyPassword(data) {
    return await request({
        url: '/adminSever/manage/modifyPassword',
        method: 'POST',
        data
    })
}